package com.jn.algorithm.拼多多.q2021.question3;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author 江南大学1033190417
 * @date 2022/5/19 22:12
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N=scanner.nextInt();
        int M=scanner.nextInt();
        int[] array=new int[N];
        for (int i=0;i<N;i++){
            array[i]= scanner.nextInt();
        }
        int count=0;
        for (int i = 1; i <= N; i++) {//i为索取的区间
            for (int j = 0; j <= N-i; j++) {//从j下标开始计数
                int sum=0;
                for (int k = 0; k < i; k++) {//计数的次数
                    sum+=array[j+k];
                }
                if (sum%M==0){
                    ++count;
                }
            }
        }
        System.out.println(count);

    }
}
